/**
 * @Description
 * @author 20155870 杨润增
 * @create 2018-06-10 19:11
 **/
package com.campus_information_portal.controller;

import com.campus_information_portal.entity.Studybyoneself;
import com.campus_information_portal.service.SelfStudyService;
import com.campus_information_portal.util.Message;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * @className SelfStudyController
 * @Description
 * @author
 * @create 2018-06-10 19:11
 **/
@Controller
@RequestMapping("/selfStudy")
@ResponseBody
@CrossOrigin(origins = "*")
public class SelfStudyController {
    @Autowired
    private SelfStudyService selfStudyService;

    @RequestMapping(value = "/queryAll",method = RequestMethod.GET)
    public Message queryAll(){
        return selfStudyService.queryAll();
    }

    @RequestMapping(value = "/queryMySelf",method = RequestMethod.GET)
    public Message queryMySelf(@Param("queryByStuId") Integer stuInoId){
        return selfStudyService.queryByStuId(stuInoId);
    }

    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Message add(@RequestBody Studybyoneself studybyoneself){
        return selfStudyService.add(studybyoneself);
    }


    @RequestMapping(value = "/update",method = RequestMethod.GET)
    public Message update(@Param("studybyoneselfFlag") Integer studybyoneselfFlag,@Param("studybyoneselfId") Integer studybyoneselfId){
        return selfStudyService.update(studybyoneselfFlag,studybyoneselfId);
    }
}
